package fr.oz.mobile.ui.profile 
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.filters.BitmapFilterQuality;
	import flash.filters.BlurFilter;
	import flash.text.TextField;
	import fr.digitas.flowearth.text.styles.styleManager;
	
	
	/**
	 * ...
	 * @author Djim
	 */
	public class PlaylistButton extends Sprite 
	{
		private var isSelected:Boolean;
		private var rub:String;
		private var label:TextField;
		private var id:int;
		public var sSelected:Boolean;
		public var type:String;
		
		public function getIsSelected():Boolean { return sSelected; }
		
		public function getId():int { return this.id; }
		
		public function PlaylistButton(rub:String, id:int) 
		{
			addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
			this.rub = rub;
			this.id = id;
		}
		
		private function addedToStageHandler(e:Event):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
			addEventListener(Event.REMOVED_FROM_STAGE, removedFromStageHandler);
			
			init();
		}
		
		public function select() : void
		{
			
			sSelected = true;
			
			var blur:BlurFilter = new BlurFilter();  
            blur.blurX = 3;  
            blur.blurY = 4;  
            blur.quality = BitmapFilterQuality.MEDIUM;  
  
            label.filters = [blur]
		}
		
		public function unselect() : void
		{
			label.filters = null;
			
			sSelected = false;
		}
		
		private function init():void 
		{
			label = new TextField();
			
			styleManager.apply(label, ".home_labels", rub);
			addChild(label);
			
			label.x = ( stage.stageWidth - label.textWidth ) / 2
			
			mouseChildren = false;
		}
		
		private function removedFromStageHandler(e:Event):void 
		{
			
		}
		
	}

}